import 'package:flutter/material.dart';
import 'package:hi_flutter/app_page.dart';

class GestureDetectorPage extends StatefulWidget {
  const GestureDetectorPage({Key? key}) : super(key: key);

  @override
  State<GestureDetectorPage> createState() => _GestureDetectorPageState();
}

class _GestureDetectorPageState extends State<GestureDetectorPage>
    with SingleTickerProviderStateMixin {
  late AnimationController controller;
  late CurvedAnimation curve;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    controller = AnimationController(
      vsync: this,
      duration: const Duration(microseconds: 2000),
    );
    curve = CurvedAnimation(
      parent: controller,
      curve: Curves.easeIn,
    );
  }



  @override
  Widget build(BuildContext context) {
    return AppPage(
      body: Center(
        child: GestureDetector(
          onTapDown: (TapDownDetails details) {
            print(details.toString());
          },
          onTapUp: (TapUpDetails details) {
            print(details.toString());
          },
          onTap: (){
            print("onTap");
          },
          onTapCancel: () {
            print("onTapCancel");
          },
          onLongPress: () {
            print("onLongPress");
          },
          onDoubleTap: () {
            if (controller.isCompleted) {
              controller.reverse();
            } else {
              controller.forward();
            }
          },
          child: RotationTransition(
            turns: curve,
            child: const FlutterLogo(
              size: 200.0,
            ),
          ),
        ),
      ),
    );
  }
}
